<template>
	<div class="school">
		<h2>学校名称：{{name}}</h2>
		<h2>学校地址：{{address}}</h2>
	</div>
</template>

<script>
	export default {
		name:'s-school',
		data() {
			return {
				name:'********',
				address:'北京·昌平'
			}
		},
		mounted(){
			//x指的是vc
			//找到x组件，给他绑定了一个hello事件
			this.$bus.$on('hello',(data)=>{
				console.log('数据:',data)
			})
		},
		beforeDestroy(){
			this.$bus.$off('hello')
		}
	}
</script>

<style scoped>
	.school{
		background-color: grey;
		padding: 5px;
	}
</style>